<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    //		搞个生成器，主函数

    function* main(){
      let res =  yield getHot("http://120.48.109.174:8081/area/hot");
        
        yield getHouse("http://120.48.109.174:8081/houses",res)
        
    }
    let it = main();
    it.next()
   function getHot(urls){
        $.ajax({
            type: "get",
            url: urls,
            success: function (res) {
                it.next(res)
            }
        });
    }
   function getHouse(urls,res){
        $.ajax({
            type: "get",
            url: urls,
            data: {
                "cityId":res.body[0].value
            },
            success: function (response) {
                it.next();
                console.log(response);
            }
        });
    }
</script>
</html>